<?php
/*
 * Copyright (c) 2008, 2009 Conor McDermottroe
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without 
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, 
 *    this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice, 
 *    this list of conditions and the following disclaimer in the documentation 
 *    and/or other materials provided with the distribution.
 * 3. Neither the name of the author nor the names of any contributors to the 
 *    software may be used to endorse or promote products derived from this 
 *    software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
 * POSSIBILITY OF SUCH DAMAGE.
 */
/* XXX Autogenerated - do not edit XXX*/
/**	@package vBulletinAPI
 *	@filesource
 */

/** Base data class. */
require_once("DataObject.php");

/** Represent all or part of a thread in a vBulletin system.
 *
 *	@property	int $id 				The ID of the thread within vBulletin.
 *	@property	Forum $forum				The forum the thread is in.
 *	@property	string $title			The thread title.
 *	@property	DateTime $createTime		The time of thread creation.
 *	@property	DateTime $lastUpdateTime	The time the thread was last
 *											updated.
 *	@property	int $status 			A bitmask describing the status of this
 *										thread
 *	@property	int $numPosts			The number of posts in the thread (NOT
 *										the number of posts being returned).
 *	@property	int $numViews			The number of times the thread has been
 *										viewed.
 *	@property	array $posts				An array where the keys are post
 *											numbers and the values are {@link
 *											Post} objects.
 *	@property	Poll $poll				The poll (if any) which is attached to
 *										this thread.
 *	@property	Icon $icon				The icon (if any) for this thread.
 *	@property	int $numStars			The star rating for this thread.
 *	@package	vBulletinAPI
 */
class Thread
extends DataObject
{
	/** The thread is locked. */
	public static $STATUS_LOCKED = 1;

	/** The thread is deleted. */
	public static $STATUS_DELETED = 2;

	/** The thread is sticky. */
	public static $STATUS_STICKY = 4;

	/** The thread contains posts with attachments */
	public static $STATUS_HAS_ATTACHMENTS = 8;

	/** The thread contains deleted posts */
	public static $STATUS_HAS_DELETED_POSTS = 16;

	/** The thread contains hidden posts */
	public static $STATUS_HAS_HIDDEN_POSTS = 32;

	/** Create a new {@link Thread}.
	 *
	 *	@param	int $id 				The ID of the thread within vBulletin.
	 *	@param	Forum $forum				The forum the thread is in.
	 *	@param	string $title			The thread title.
	 *	@param	DateTime $createTime		The time of thread creation.
	 *	@param	DateTime $lastUpdateTime	The time the thread was last
	 *										updated.
	 *	@param	int $status 			A bitmask describing the status of this
	 *									thread
	 *	@param	int $numPosts			The number of posts in the thread (NOT
	 *									the number of posts being returned).
	 *	@param	int $numViews			The number of times the thread has been
	 *									viewed.
	 *	@param	array $posts				An array where the keys are post
	 *										numbers and the values are {@link
	 *										Post} objects.
	 *	@param	Poll $poll				The poll (if any) which is attached to
	 *									this thread.
	 *	@param	Icon $icon				The icon (if any) for this thread.
	 *	@param	int $numStars			The star rating for this thread.
	 */
	public function __construct($id, Forum $forum = NULL, $title = "", DateTime $createTime = NULL, DateTime $lastUpdateTime = NULL, $status = 0, $numPosts = -1, $numViews = -1, $posts = array(), Poll $poll = NULL, Icon $icon = NULL, $numStars = -1) {
		$this->data['id'] = $id;
		$this->type['id'] = "int";
		$this->data['forum'] = $forum;
		$this->type['forum'] = "Forum";
		$this->data['title'] = $title;
		$this->type['title'] = "string";
		$this->data['createTime'] = $createTime;
		$this->type['createTime'] = "DateTime";
		$this->data['lastUpdateTime'] = $lastUpdateTime;
		$this->type['lastUpdateTime'] = "DateTime";
		$this->data['status'] = $status;
		$this->type['status'] = "int";
		$this->data['numPosts'] = $numPosts;
		$this->type['numPosts'] = "int";
		$this->data['numViews'] = $numViews;
		$this->type['numViews'] = "int";
		$this->data['posts'] = $posts;
		$this->type['posts'] = "array";
		$this->data['poll'] = $poll;
		$this->type['poll'] = "Poll";
		$this->data['icon'] = $icon;
		$this->type['icon'] = "Icon";
		$this->data['numStars'] = $numStars;
		$this->type['numStars'] = "int";
	}

	/** Default values for the properties. These will be used to minimise the 
	 *	data to be sent over the wire.
	 *
	 *	@return	array	Default values for properties which have them.
	 */
	protected function defaultPropertyValues() {
		return array(
			"forum" => NULL,
			"title" => "",
			"createTime" => NULL,
			"lastUpdateTime" => NULL,
			"status" => 0,
			"numPosts" => -1,
			"numViews" => -1,
			"posts" => array(),
			"poll" => NULL,
			"icon" => NULL,
			"numStars" => -1,
		);
	}
	
	/** Get the names of the required constructor parameters in the order in
	 *	which they must appear in the constructor.
	 *
	 *	@return	array	An array containing the names of the properties which
	 *					must appear in order in the constructor parameters.
	 */
	public static function requiredConstructorParams() {
		return array(
			"id",
		);
	}
}
?>
